<template>
	<view>
		<up-card v-for="(item, index) in props.userInfo">
			<template #body>
				<view class="" slot="body">
					<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
						<view class="u-body-item-title u-line-3">
							<p style="margin: 10rpx 0;">名称：{{item.name}}</p>
							<p style="margin: 10rpx 0;">密码：{{item.password}}</p>
							<p>权限：<up-tag :text="item.right" type="error" plain></up-tag></p>
						</view>
					</view>
				</view>
			</template>
			<template #foot>
				<view class="footer" slot="foot">
					<up-button type="error" text="删除用户" @click="delUser(item)" style="width: 70%;"></up-button>
				</view>
			</template>
		</up-card>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		computed,
		onMounted,
	} from 'vue'
	import {apidelUser} from '@/api/apis.js'
	const props = defineProps({
		
		userInfo: {
			type: Array,
			default: () => {
				return []
			}
		}
	})
	const delUser =async (item) => {
		const res = await apidelUser({item})
		uni.showToast({
			title: '删除成功',
			icon: 'success',
			success() {
				uni.navigateBack({
					delta: 1
				})
			}
		})
	}
</script>

<style lang="scss">
	.u-card-wrap {
		background-color: #ffffff;
		padding: 1px;
	}

	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}
	.footer {
		display: flex;
		justify-content: flex-end;
	}
</style>